﻿@model Tasks.UI.Models.SceneryModels.SceneryDataBaseManage
@{
    Layout = "~/Views/Account/_AccountMaster.cshtml";
}
@section head{
    <style type="text/css">
        /* 搜索栏 div */
        .search
        {
            background: url(/images/inquiry_bgtop.jpg) no-repeat;
            margin-top: 10px;
            margin-bottom: 10px;
            padding: 10px 0px 0px 0px;
        }
        .search table
        {
            padding: 2px;
            width: 100%;
            background: #cbecff url(/images/inquiry_bgbottom.jpg) no-repeat 0 bottom;
        }
    </style>
    <script type="text/javascript">

        //init
        $(function () {
            initProvince("#ProvinceID");
            initCity("#CityID");

            initTable(".tblStyle1");
        })

        function setState(sceneryID, state) {
            $("#SceneryID").val(sceneryID);
            goto(state);
        }

        function goto(act) {
            $("#act").val(act);
            document.forms[0].submit();
        }
        //删除数据
        function ConfirmDel(sceneryID) {
            $.Msg.confirmDelete(
             function () {
                 $("#SceneryID").val(sceneryID);
                 $("#act").val("delete");
                 $("form").submit();
             }
        );
        }
    </script>
}
@using (Html.BeginForm())
{
    <input id="act" name="act" type="hidden" />
    <input id="SceneryID" name="SceneryID" type="hidden" />
    <div class="navTitle">
        景点管理</div>
    <div class="searchBar">
        <table>
            <tr>
                <td>
                    <strong>景点名称：</strong>
                    @Html.TextBoxFor(t => t.SceneryName)
                    <strong>景区级别：</strong>
                    @Html.DropDownListFor(t => t.Level, PageHelper.SceneryLevelSelector(Model.Level))
                    <strong>景点位置：</strong>
                    @Html.DropDownList("ProvinceID", PageHelper.ProvinceSelector(Model.ProvinceID))
                    @Html.DropDownList("CityID", PageHelper.CitySelector(Model.CityID, Model.ProvinceID))
                    @Html.DropDownList("AreaID", PageHelper.AreaSelector(Model.AreaID, Model.CityID))
                    <input id="btnSearch" type="button" class="btnSearch" value="查询" onclick="goto('search')" />
                    <a href="javascript:void(0)" onclick="openTab('添加景点','/Account/SceneryEdit',true)">添加新景点</a>
                </td>
            </tr>
        </table>
        <div class="bottom">
        </div>
    </div>
    <div class="pageBody">
        <table class="tblStyle1" border="1" style="table-layout: fixed; width: 100%;">
            <thead>
                <tr>
                    <th style="width: 10%;">
                        状态
                    </th>
                  <th style="width: 40%;">
                        景区名称
                    </th>
                    <th style="width: 10%;">
                        景区级别
                    </th>
                  <th style="width: 20%;">
                        景点位置
                    </th>
                   <th style="width: 10%;">
                        支付方式
                    </th>
                   <th style="width: 10%;">
                        操作
                    </th>
                </tr>
            </thead>
            <tbody>
                @foreach (Scenery scenery in Model.Scenerys)
                {
                    if (scenery.Contact == null)
                    {
                        scenery.Contact = new ContactInfo();
                    }
                    <tr>
                        <td class="c">
                            @CommonUtil.GetEnumDescription(typeof(EnterpriseMemberState),scenery.State)
                        </td>
                        <td>
                            @scenery.SceneryName
                        </td>
                        <td class="c">
                            @(scenery.Level)
                            A
                        </td>
                        <td class="c">
                           @scenery.Contact.Position
                        </td>
                        <td class="c">
                            @CommonUtil.GetEnumDescription(typeof(EnterprisePaymentMode), scenery.PaymentMode)
                        </td>
                        <td class="c">
                            <a href="javascript:void(0)" onclick="parent.showModalDialog('/Account/SceneryEdit?SceneryID=@scenery.SceneryID',true)">
                                <img src="/images/icon/16x16/file_edit.png" title="编辑" /></a> <a href="javascript:void(0);"
                                  onclick="ConfirmDel(@scenery.SceneryID)" title="删除">
                                    <img src="/images/icon/16x16/delete.png" title="删除" /></a>
                            @if (scenery.State == (int)SceneryState.暂停销售)
                            {
                                <a href="javascript:;" onclick="setState(@scenery.SceneryID,'tostart')" title="状态：停用或启用">
                                    <img src="/images/icon/16x16/enable.png" title="启用" /></a>
                            }
                            @if (scenery.State == (int)SceneryState.销售中)
                            {
                                <a href="javascript:;" onclick="setState(@scenery.SceneryID,'blockup')" title="状态：停用或启用">
                                    <img src="/images/icon/16x16/stop.png" title="禁用" /></a>
                            }
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
    <div class="pageFooter">
        @Html.RenderPageNav(Model.PageIndex, Model.PageSize, Model.RowCount, "", PageNavStyle.Form)
    </div>
}
